class Faculty < ActiveRecord::Base
  has_many :groups
  has_many :profiles, :through => :groups
  
  validates_presence_of :name, :abbreviation, :building
  
  def as_json(options = {})
  {
    id: self.id,
    groups: (options[:except] == "groups") ? nil : self.groups,
    created_at: self.created_at,
    updated_at: self.updated_at,
    abbreviation: self.abbreviation,
    name: self.name,
    building: self.building
  }
  end
end
